package com.bigfire.dtm.domain.ability.aggregate;

public class ProgrammerCompetenceModel extends Programmer implements ICompetenceModel {
    //权重
    public static final double weightDoneEfficiency = 0.1;
    public static final double weightDoneRate = 0.15;
    public static final double weightInRate = 0.05;
    public static final double weightDelayRate = 0.05;
    public static final double weightQuality = 0.1;
    public static final double weightFeeRate = 0.15;
    public static final double weightBuzRate = 0.1;
    public static final double weightTechEfficiency = 0.1;
    public static final double weightCapability = 0.1;
    public static final double weightCoach = 0.05;
    public static final double weightTech = 0.01;
    public static final double weightTrain = 0.01;

    public ProgrammerCompetenceModel(double doneTaskNum, double doneTaskTime, double receiveTaskNum, double delayTaskNum, double delayTaskTime, double bugNum, double bugTime, double fee, int level, double realTime, double effectTime, double coach, double tech, double train) {
        super(doneTaskNum, doneTaskTime, receiveTaskNum, delayTaskNum, delayTaskTime, bugNum, bugTime, fee, level, realTime, effectTime, coach, tech, train);
    }


    public double getDoneEfficiencyValue() {
        return this.getDoneEfficiencyValue(getDoneTaskTime(), getDoneTaskNum());
    }

    public double getDoneRateValue() {
        return this.getDoneRateValue(getDoneTaskNum(), getReceiveTaskNum());
    }

    public double getInRateValue() {
        return this.getInRateValue(getReceiveTaskNum(), ProgrammerCompetenceModel.allTaskNum);
    }

    public double getDelayRateValue() {
        return this.getDelayRateValue(getDelayTaskTime(), getDelayTaskNum());
    }

    public double getQualityValue() {
        return this.getQualityValue(getBugTime(), getBugNum());
    }

    public double getFeeRateValue() {
        return this.getFeeRateValue(getFee(), getLevel());
    }

    public double getBuzRateValue() {
        return this.getBuzRateValue(getRealTime(), getCapacity());
    }

    public double getTechEfficiencyValue() {
        return this.getTechEfficiencyValue(getEffectTime(), getRealTime());
    }

    public double getCapabilityValue() {
        return this.getCapabilityValue(getCapacity());
    }


    public double getCoachValue() {
        return this.getCoachValue(getCoach(), ProgrammerCompetenceModel.allProgrammerNum);
    }


    public double getTechValue() {
        return this.getTechValue(getTech(), ProgrammerCompetenceModel.allTechNum);
    }

    public double getTrainValue() {
        return this.getTrainValue(getTrain(), ProgrammerCompetenceModel.allTrainNum);
    }

    //个人贡献常量
    double normalCoach = 0;
    double normalTech = 0;
    double normalTrain = 0;

    public double getCoachValue(double inCoachNum, double inAllProNum) {
        double rate = inCoachNum / inAllProNum;
        return rate - normalCoach;
    }

    public double getTechValue(double inTechNum, double inAllTechNum) {
        double rate = inTechNum / inAllTechNum;
        return rate - normalTech;
    }

    public double getTrainValue(double inTrainNum, double inAllTrainNum) {
        double rate = inTrainNum / inAllTrainNum;
        return rate - normalTrain;
    }

    public static void main(String[] args) {

        //程序员1的胜任力
        //Programmer programmer1 = new Programmer(6,3,10,3,2,2,1,20000,7,1,0.8,5,1,1);
        ProgrammerCompetenceModel programmerCompetenceModel1 = new ProgrammerCompetenceModel(6, 3, 10, 3, 2, 2, 1, 20000, 7, 1, 0.8, 5, 1, 1);

        double outputV1 = programmerCompetenceModel1.getCompetenceOutputValue();
        double feeV1 = programmerCompetenceModel1.getCompetenceFeeRateValue();
        double wishV1 = programmerCompetenceModel1.getCompetenceWishValue();
        double capabilityV1 = programmerCompetenceModel1.getCompetenceCapabilityValue();
        double personalV1 = programmerCompetenceModel1.getCompetenceGrowValue();

        //程序员2的胜任力
        //Programmer programmer2 = new Programmer(8,3.5,10,2,1,4,2,25000,7,1.25,1.2,2,0,2);
        ProgrammerCompetenceModel programmerCompetenceModel2 = new ProgrammerCompetenceModel(8, 3.5, 10, 2, 1, 4, 2, 25000, 7, 1.25, 1.2, 2, 0, 2);

        double outputV2 = programmerCompetenceModel2.getCompetenceOutputValue();
        double feeV2 = programmerCompetenceModel2.getCompetenceFeeRateValue();
        double wishV2 = programmerCompetenceModel2.getCompetenceWishValue();
        double capabilityV2 = programmerCompetenceModel2.getCompetenceCapabilityValue();
        double personalV2 = programmerCompetenceModel2.getCompetenceGrowValue();

        System.out.println("程序员1：" + outputV1 + "," + feeV1 + "," + wishV1 + "," + capabilityV1 + "," + personalV1 + ";");
        System.out.println("\n");
        System.out.println("程序员2：" + outputV2 + "," + feeV2 + "," + wishV2 + "," + capabilityV2 + "," + personalV2 + ";");
    }

    public double getCompetenceOutputValue() {
        return getDoneEfficiencyValue() * weightDoneEfficiency + getDoneRateValue() * weightDoneRate + getInRateValue() * weightInRate + getDelayRateValue() * weightDelayRate + getQualityValue() * weightQuality;
    }


    public double getCompetenceFeeRateValue() {
        return getFeeRateValue() * weightFeeRate;
    }


    public double getCompetenceWishValue() {
        return getBuzRateValue() * weightBuzRate + getTechEfficiencyValue() * weightTechEfficiency;
    }

    public double getCompetenceCapabilityValue() {
        return getCapabilityValue() * weightCapability;
    }

    public double getCompetenceGrowValue() {
        //需要把值归一化
        return getCoachValue() * weightCoach + getTechValue() * weightTech + getTrainValue() * weightTrain;
    }

}


